package com.yejiali.backend.controller;

import com.yejiali.backend.entity.dto.*;
import com.yejiali.backend.entity.vo.VideosVO;
import com.yejiali.backend.response.Response;
import com.yejiali.backend.service.VideosService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * 视频作品表(Videos)表控制层
 *
 * @author yejiali
 * @since 2025-07-21 15:20:42
 */
@RestController
@RequestMapping("videos")
public class VideosController{

    @Autowired
    private VideosService videosService;

    /**
     * 获取视频列表
     */
    @GetMapping("/getVideoList")
    public Response<VideoListDTO> getVideos(@RequestParam("pageNum") int pageNum, @RequestParam("pageSize") int pageSize) {
        return videosService.getVideos(pageNum,pageSize);
    }

    /**
     * 上传视频
     */
    @PostMapping("/upload")
    public Response<String> uploadVideo(@RequestBody UploadVideoDTO uploadVideoDTO) {
        return videosService.uploadVideo(uploadVideoDTO);
    }

    /**
     * 获取视频详情
     */
    @GetMapping("/detail")
    public Response<VideoDetailDTO> getVideoDetail(@RequestParam Long videoId,@RequestParam(required = false) Long userId) {
        return videosService.getVideoDetail(videoId,userId);
    }

    /**
     * 根据目前观看视频分区推荐视频
     */
    @GetMapping("/recommend")
    public Response<List<VideosVO>>  recommendVideos(@RequestParam Long videoId) {
        return videosService.recommendVideos(videoId);
    }






}

